version: 0.18.10_b{build}

os: unstable

image:
- Visual Studio 2013

branches:
  only:
  - master

environment:
  PRO_FILE: 'C:\projects\quiterss\QuiteRSS.pro'

  matrix:
#  - BUILD: Qt4.8.6-x86-mingw32
#    COMPILERDIR: 'c:\mingw\bin'
#    QMAKESPEC: win32-g++
#    PRO_MAKE: mingw32-make
#    PRO_CHECK: mingw32-make check
#    QTMOVE: '$OUTDIR\bin 4.8.6-x86-mingw32'
#    QTSUB: '4.8.6-x86-mingw32'
#    QTDOWNLOAD1: http://download.qt.io/archive/qt/4.8/4.8.6/qt-opensource-windows-x86-mingw482-4.8.6-1.exe
#    QTARCHIVE1: 'qt-opensource-windows-x86-mingw482-4.8.6-1.exe'
#    QTARCHIVE1_OPTS: '"-ir!?OUTDIR\*" "-xr!*doc\*" "-xr!*examples\*" "-xr!*demos\*"'
    
#  - BUILD: Qt4.8.6-x86-msvc2010
#    COMPILERBAT: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86'
#    PRO_MAKE: nmake release
##    PRO_CHECK: 'cd build\%BUILD%\release\target && dir && QuiteRSS.exe'
#    PRO_CHECK: 'cd release\target && dir && cd ..\..'
#    QMAKESPEC: win32-msvc2010
#    QTMOVE: '$OUTDIR\bin 4.8.6-msvc2010'
#    QTSUB: '4.8.6-msvc2010'
#    QTDOWNLOAD1: http://download.qt.io/archive/qt/4.8/4.8.6/qt-opensource-windows-x86-vs2010-4.8.6.exe
#    QTARCHIVE1: 'qt-opensource-windows-x86-vs2010-4.8.6.exe'
#    QTARCHIVE1_OPTS: '"-ir!?OUTDIR\*" "-xr!*doc\*" "-xr!*examples\*" "-xr!*demos\*"'
    
  - BUILD: Qt5.4.1-mingw32
    QTDIR: 'c:\qt\5.4\mingw491_32'
    COMPILERDIR: 'c:\qt\tools\mingw491_32\bin'
    QMAKESPEC: win32-g++
    PRO_MAKE: mingw32-make
    PRO_CHECK: mingw32-make check

  - BUILD: Qt5.4.1-x86-msvc2013
    QTDIR: 'c:\qt\5.4\msvc2013_opengl'
    COMPILERBAT: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86'
    QMAKESPEC: win32-msvc2013
    PRO_MAKE: nmake
    PRO_CHECK: nmake check
    
  - BUILD: Qt5.4.1-x64-msvc2013
    QTDIR: 'c:\qt\5.4\msvc2013_64_opengl'
    COMPILERBAT: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86_amd64'
    QMAKESPEC: win32-msvc2013
    PRO_MAKE: nmake
    PRO_CHECK: nmake check
    
#  - BUILD: 'Qt5.4.1-x86-msvc2013'
#    COMPILERBAT: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86'
#    PRO_MAKE: nmake
#    PRO_CHECK: nmake check
#    QMAKESPEC: win32-msvc2013
#    QTSUB: '5.4\msvc2013_opengl'
#    QTDOWNLOAD1: http://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_54/qt.54.win32_msvc2013_opengl/5.4.1-0qt5_essentials.7z
#    QTARCHIVE1: '5.4.1-0qt5_essentials.7z'
#    QTDOWNLOAD2: http://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_54/qt.54.win32_msvc2013_opengl/5.4.1-0icu_53_1_msvc_2013_32.7z
#    QTARCHIVE2: '5.4.1-0icu_53_1_msvc_2013_32.7z'

install:
- ls C:\Qt\5.4
# prepare extern install
- choco install curl 7zip # dependencywalker
- mkdir extern
- cd extern

# install Qt
- mkdir Qt
- cd Qt
- if defined QTDOWNLOAD1 curl -kLO %QTDOWNLOAD1%
- if defined QTARCHIVE1 7z x %QTARCHIVE1_OPTS% %QTARCHIVE1% >nul
- if defined QTDOWNLOAD2 curl -kLO %QTDOWNLOAD2%
- if defined QTARCHIVE2 7z x %QTARCHIVE2_OPTS% %QTARCHIVE2% >nul
- dir "C:\projects\quiterss\extern"
- dir "C:\projects\quiterss\extern\Qt"
- if defined QTMOVE dir $OUTDIR
- if defined QTMOVE move %QTMOVE%
- if defined QTSUB set "QTDIR=%CD%\%QTSUB%"
- if defined QTDOWNLOAD1 (echo [Paths]&& echo Prefix=..) >%QTDIR%\bin\qt.conf
- set QT_PLUGIN_PATH=%QTDIR%\plugins
- cd ..

# finish install
- cd ..
- set "PATH=%QTDIR%\bin;%PATH%"
- if defined COMPILERDIR set "PATH=%COMPILERDIR%;%PATH%"
- '%COMPILERBAT%'

after_build:
- 7z a "%BUILD%.zip" ".\build\%BUILD%\release\target\*"
- dir "c:\projects\quiterss"
- dir "c:\projects\quiterss\build"

build_script:
- echo "building %BUILD%"
- mkdir build
- mkdir "build\%BUILD%"
- cd "build\%BUILD%"
- set
- qmake -r CONFIG+=release %QMAKE_OPTIONS% %PRO_FILE%
- '%PRO_MAKE%'
- cd ..\..

test_script:
- cd "build\%BUILD%"
- '%PRO_CHECK%'
- cd ..\..

artifacts:
- path: $(BUILD).zip

#deploy:
## FTP deployment provider settings
#- provider: FTP
#  protocol: ftps
#  host: prokudin.org
#  username: quitefuncy
#  password:
#    secure: GUuFDbSezZ7LmK+pzK1w930brvyL+MmmU4B+ItMsa+8=
#  folder: 'files\test'
